00001
00009 #include "ndame.h"
00010
00026 void calculate(struct data*d1,int irow)
00027 {
00028 int ii=0;
00029 static int is;
00030 char chscan;
00031
00032 if(!irow)
00033 {
00034 is=0;
00035 }
00036 if(is)
00037 {
00038 return;
00039 }
00040
00041 while(irow<d1->iblength)
00042 {
00043 if(ii<d1->iblength)
00044 {
00045 if(!(attack(d1,irow,ii)))
00046 {
00047 d1->iboard[irow][ii]=1;
00048 calculate(d1,irow+1);
00049 d1->iboard[irow][ii]=0;
00050
00051 if(d1->m1==manual)
00052 {
00053 if((irow+ii)%2)
00054 {
00055 gotoxy(X_POS+ii,Y_POS+irow);
00056 printf("%c",BOARD_PART_1);
00057 }
00058 else
00059 {
00060 gotoxy(X_POS+ii,Y_POS+irow);
00061 printf("%c",BOARD_PART_2);
00062 }
00063 }
00064 ii++;
00065 }
00066 else
00067 {
00068 ii++;
00069 }
00070 }
00071 else
00072 {
00073 return;
00074 }
00075 }
00076
00077 d1->isolutions++;
00078 state(d1,5);
00079
00080 if(d1->isave)
00081 {
00082 ssolution(d1->iboard,d1->iblength,d1->isolutions,&d1->iauthor,d1->cfilename);
00083 }
00084
00085 if(d1->m1==manual)
00086 {
00087 psolution(d1);
00088 gotoxy(12,10);
00089 printf("(Any Key) - Go on");
00090 gotoxy(9,12);
00091 printf("(S) - Exit manual Step");
00092
00093 chscan=getch();
00094 if((chscan=='e')||(chscan=='s'))
00095 {
00096 if(chscan=='e')
00097 {
00098 exit(1);
00099 }
00100 is=1;
00101 }
00102 }
00103 else
00104 {
00105 if(kbhit())
00106 {
00107 chscan=getch();
00108 if(chscan=='e')
00109 {
00110 exit(1);
00111 }
00112 }
00113 }
00114 }